#include <iostream>
#include <stack>
using namespace std;

const int kMaxN = 2e5 + 10;
const int kMaxH = 1e9;

int h[kMaxN];
stack<int> s;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  long long ans = 1;

  cin >> n;
  h[0] = kMaxH + 1;
  s.push(0);
  for (int i = 1; i <= n; i++) {
    cin >> h[i];
    while (h[s.top()] <= h[i]) {
      int last_top = s.top();

      s.pop();
      ans -= (long long)h[last_top] * (last_top - s.top());
    }
    ans += (long long)h[i] * (i - s.top());
    s.push(i);
    cout << ans << " ";
  }
  cout << "\n";
  return 0;
}